package com.ygbhu.design.factory;

import com.ygbhu.design.factory.service.Car;
import com.ygbhu.design.factory.service.impl.BaoMaImpl;
import com.ygbhu.design.factory.service.impl.BenChiImpl;

/**
 * @program: design-pattern
 * @description: 汽车工厂
 * @author: smzhu3
 * @create: 2021-06-15 09:49
 **/
public class CarFactory {

    /***
     * @Description: 简单汽车工厂
     * @param type 类型
     * @return: com.ygbhu.design.factory.service.Car
     * @Author: smzhu3
     * @Date: 2021/6/15 9:51
     */
    public static Car getCar(String type) {
        if (type.equals("baoma")) {
            return new BaoMaImpl();
        } else if (type.equals("benchi")) {
            return new BenChiImpl();
        }
        return null;
    }

    public static Car getBenChiCar() {
        return new BenChiImpl();
    }

    public static Car getBaoMaCar() {
        return new BaoMaImpl();
    }
}
